﻿Public Class dmTaiKhoanCap2
    Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
        If keyData = (Keys.Control Or Keys.N) Then
            Return Me.Dmtaikhoancap2IUltraGrid.getTaoMoi()
        End If
        If keyData = (Keys.Control Or Keys.S) Then
            Me.Dmtaikhoancap2IUltraGrid.getLuu()
            Return True
        End If
        If keyData = (Keys.Control Or Keys.D) Then
            Return Me.Dmtaikhoancap2IUltraGrid.getXoa()
        End If
        'If keyData = (Keys.Control Or Keys.P) Then
        '    Return Me.getIn()
        'End If
        If keyData = (Keys.Control Or Keys.R) Then
            Return Me.Dmtaikhoancap2IUltraGrid.getRefresh()
        End If
        If keyData = (Keys.Control Or Keys.E) Then
            Return Me.Dmtaikhoancap2IUltraGrid.getSua()
        End If
        If keyData = (Keys.Control Or Keys.Q) Then
            Return getThoat()
        End If
        If keyData = (Keys.Escape) Then
            Return getThoat()
        End If
        Return MyBase.ProcessCmdKey(msg, keyData)
    End Function

    Private Sub dmTaiKhoanCap2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Cursor = Cursors.WaitCursor
        Me.Dmtaikhoancap2TableAdapter.Fill(Me.ErpharmaDataSet.dmtaikhoancap2)
        Me.Dmtaikhoancap2IUltraGrid.setDoiTuongXuLyDuLieu(Me.ErpharmaDataSet.dmtaikhoancap2, Me.Dmtaikhoancap2BindingSource, Me.Dmtaikhoancap2TableAdapter, Me.ErpharmaDataSet)
        Me.Dmtaikhoancap2IUltraGrid.setGiaoDienVua()
        Me.Dmtaikhoancap2IUltraGrid.setTimKiemTrenCotUltraGrid()
        Me.Dmtaikhoancap2IUltraGrid.setChoPhepMenuStrip()
        Me.Dmtaikhoancap2IUltraGrid.setChoPhepLuuXongKhongThemDong()
        Me.Cursor = Cursors.Default
    End Sub
    Private Sub btnTaoMoi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTaoMoi.Click
        Me.Dmtaikhoancap2IUltraGrid.getTaoMoi()
    End Sub
    Private Sub btnLuu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLuu.Click
        Me.Dmtaikhoancap2IUltraGrid.getLuu()
    End Sub
    Private Sub btnXoa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnXoa.Click
        Me.Dmtaikhoancap2IUltraGrid.getXoa()
    End Sub
    Private Sub btnLamTuoi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLamTuoi.Click
        Me.Dmtaikhoancap2IUltraGrid.getRefresh()
    End Sub
    'Private Function getIn() As Boolean
    '    Try
    '        Dim rp As dmTaiKhoanCap2_report = New dmTaiKhoanCap2_report
    '        rp.setDt(Me.Dmtaikhoancap2IUltraGrid.getDatatableTuIUltraGrid("dmtaikhoancap2"))
    '        rp.Show()
    '        'Me.Dmtaikhoancap2IUltraGrid.DataSource = Me.ErpharmaDataSet.dmtaikhoancap2
    '    Catch ex As Exception
    '        Return False
    '    End Try
    '    Return True
    'End Function
    'Private Sub btnIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnIn.Click
    '    getIn()
    'End Sub
    Private Function getThoat() As Boolean
        Try
            If Me.Dmtaikhoancap2IUltraGrid.getClose Then
            End If
            Me.Dispose()
            Me.Close()
        Catch ex As Exception
            Return False
        End Try
        Return True
    End Function
    Private Sub btnThoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThoat.Click
        getThoat()
    End Sub
    Private Sub btnSua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSua.Click
        Me.Dmtaikhoancap2IUltraGrid.getSua()
    End Sub
End Class